<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
		<meta charset="utf-8" />
		<title>校园招聘</title>
		<link rel="stylesheet" href="css/bootstrap.min.css">
		<link href="css/content.css" rel="stylesheet">
		<link href="css/footer.css" rel="stylesheet">
		<script type="text/javascript" src="js/jquery-3.4.1.js"></script>
		<script type="text/javascript" src="js/bootstrap.min.js"></script>
		<script type="text/javascript">
			if(${sessionScope.setflag1}==1){
				alert("修改成功");
			}else if(${sessionScope.setflag1}==0){
				alert("服务器繁忙，请稍后再试");
			}
		</script>
	</head>
	<body>	<c:remove var="setflag1"/>
		<!-- 导入导航栏 -->
		<jsp:include page="/common/header.jsp"></jsp:include>
		<!--内容-->
		<div class="big_content pt_33">
			<div class="content clearfix">
				<!--内容左-->
				<div class="content1_l">
					<div class="biaoti_01 clearfix">
						<div class="h11">我的简历</div>
					</div>
					<form class="wdmp_box clearfix" action="person/resetinfo " method="post"  enctype="multipart/form-data">
						<div class="biaoti_02 wdmp"><a>我的名片</a></div>
						<div class="touxiang clearfix">
							<img style="width:100px; height:100px; border-radius:50%;" src="<c:url value='images/${user.photo }'/>" id="avatar_img" />
							<div class="xm">${user.name}</div>
							<span id="setphoto"></span>
							<input type="hidden" name="id" value="${user.id }">
						</div>
						<div class="bianji">
							<img src="image/wodejianli/bianji.png" style="cursor: pointer;" onclick="resetphoto()" />
						</div>
						<div style="float:right;">
							<span id="botton1"></span>
						</div>
					</form>
					<form  class="qzyx_box clearfix" action="person/resetinfo " method="post"  enctype="multipart/form-data">
						<div class="biaoti_02 qzyx"><a>基本资料</a><span></span></div>
						<div class="qzyx_text clearfix">
							<div><span id="setname">姓名：${user.name} </span></div>
							<div><span id="setsex">性别：${user.sex==0? "男" :"女"} </span></div>
							<div><span id="setphone">手机号码：${user.phone }</span></div>


							<div><span id="setyear">出生年月：
									<fmt:formatDate pattern="yyyy-MM-dd" value="${user.birthday }" /> </span></div>


							<div><span id="setemail"> 常用邮箱：${user.email }</span></div>
							<input type="hidden" name="id" value="${user.id }">

						</div>
						<div class="bianji">
							<img src="image/wodejianli/bianji.png" style="cursor: pointer;" onclick="resetbase()" />
						</div>
						<div style="float:right;">
							<span id="botton2"></span>
						</div>
					</form>
					<form  class="qzyx_box clearfix" action="person/resetinfo " method="post"  enctype="multipart/form-data">
						<div class="biaoti_02 qzyx"><a>详细资料</a><span></span></div>
						<div class="qzyx_text clearfix">
							<input type="hidden" name="id" value="${user.id }">
							<div><span id="setdegree">学历：${user.degree }</span></div>
							<div><span id="setpro">专业：${user.pro } </span> </div>
							<div><span id="setschool">毕业院校：${user.school }</span></div>
							<div><span id="setsalary">期望月薪：${user.salary }/月</span></div>
							<div><span id="setworktime">到岗时间：
									<fmt:formatDate pattern="yyyy-MM-dd" value="${user.worktime }" /></span></div>


							<div><span id="setexp">工作经验：${user.exp }</span></div>
							<div><span id="settips">个人描述：${user.tips }</span></div>
						</div>
						<div class="bianji">
							<img src="image/wodejianli/bianji.png" style="cursor: pointer;" onclick="resetbase1()" />
						</div>
						<div style="float:right;">
							<span id="botton3"></span>
						</div>
					</form>
				</div>
			</div>
		</div>
		<!-- 导入底部信息 -->
		<jsp:include page="/common/footer.jsp"></jsp:include>

		<script type="text/javascript">
			function resetphoto() {
				document.getElementById("setphoto").innerHTML = "<input type='file' id='file' name='file' />"
				document.getElementById("botton1").innerHTML =
					"<input class='btn' type='submit' value='确认' />&nbsp;&nbsp;<input class='btn' type='button' value='取消' onclick='exit1()'/>"
			}

			function exit1() {
				document.getElementById("setphoto").innerHTML = ""
				document.getElementById("botton1").innerHTML = ""
			}

			function resetbase() {
				document.getElementById("setname").innerHTML = "姓名：<input type='text' name='name'  placeholder='请输入名字'/>"
				document.getElementById("setsex").innerHTML =
					"性别：<input type='radio' name='sex' value='0' checked='checked'> 男<input type='radio' name='sex' value='1'>女 "
				document.getElementById("setphone").innerHTML = "联系方式：<input type='text' name='phone' placeholder='联系方式' />"
				document.getElementById("setyear").innerHTML = "出生年日：<input type='date' name='birthday' />"
				document.getElementById("setemail").innerHTML = "邮箱：<input type='text' name='email' placeholder='电子邮箱'/>"


				document.getElementById("botton2").innerHTML =
					"<input class='btn' type='submit' value='确认' />&nbsp;&nbsp;<input class='btn' type='button' value='取消' onclick='exit2()'/>"


			}

			function exit2() {
				document.getElementById("setname").innerHTML = "姓名：${user.name} "
				document.getElementById("setsex").innerHTML = "性别：${user.sex==0? '男 ' :'女 '} "
				document.getElementById("setphone").innerHTML = "手机号码：${user.phone }"
				document.getElementById("setyear").innerHTML =
					"出生年月：<fmt:formatDate pattern='yyyy-MM-dd'  value='${user.birthday }' />"
				document.getElementById("setemail").innerHTML = "常用邮箱：${user.email }"

				document.getElementById("botton2").innerHTML = ""
			}

			function resetbase1() {
				document.getElementById("setdegree").innerHTML =
					"学历：<select name='degree'><option selected>请选择</option><option>高中及以下</option><option>大专</option><option>本科</option><option>硕士</option><option>博士</option></select>"
				document.getElementById("setpro").innerHTML = "专业：<input type='text' name='pro' />"
				document.getElementById("setschool").innerHTML = "毕业院校：<input type='text' name='school' placeholder='学校'/>"
				document.getElementById("setsalary").innerHTML =
					"薪资：<select name='salary'><option selected>请选择</option><option>3k以下</option><option>3k-4k</option><option>3k-4k</option><option>4k-5k</option><option>5k-6k</option><option>7k-8k</option><option>8k以上</option></select>"
				document.getElementById("setworktime").innerHTML = "到岗时间“<input name='worktime' type='date'/>"
				document.getElementById("setexp").innerHTML = "工作经验:<textarea name='exp' value='无'>"
				document.getElementById("settips").innerHTML = "个人描述:<textarea name='tips'  value='无'>"

				document.getElementById("botton3").innerHTML =
					"<input class='btn' type='submit' value='确认' />&nbsp;&nbsp;<input class='btn' type='button' value='取消' onclick='exit3()'/>"


			}

			function exit3() {
				document.getElementById("setdegree").innerHTML = "学历：${user.degree } "
				document.getElementById("setpro").innerHTML = "专业：${user.pro } "
				document.getElementById("setschool").innerHTML = "毕业院校：${user.school }"
				document.getElementById("setsalary").innerHTML = "期望月薪：${user.salary }/月"
				document.getElementById("setworktime").innerHTML =
					"到岗时间：：<fmt:formatDate pattern='yyyy-MM-dd'  value='${user.worktime }' />"
				document.getElementById("setexp").innerHTML = "工作经验：${user.exp }"
				document.getElementById("settips").innerHTML = "个人描述：${user.tips }"
				document.getElementById("botton3").innerHTML = ""
			}












			// 个人头像预览
			$("#file").change(function() {
				// 获取上传文件对象
				var file = $(this)[0].files[0];
				// 读取文件URL
				var reader = new FileReader();
				reader.readAsDataURL(file);
				// 阅读文件完成后触发的事件
				reader.onload = function() {
					// 读取的URL结果：this.result
					$("#avatar_img").attr("src", this.result);
				}
			});
		</script>



	</body>
</html>
